[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

Cell References

Each set of horizontal cells in a worksheet is a row, and each set of vertical cells is a column. A cell's row and column combination designates the location of that cell. [Guidance An implementation is encouraged to not unnecessarily limit the number of rows and columns in a worksheet. end guidance]

A cell reference designates one or more cells on the same worksheet. Using references, one can:

Use data contained in different parts of the same worksheet in a single formula.

Use the value from a single cell in several formulas.

Refer to cells on other sheets in the same workbook, and even to other workbooks. (References to cells in other workbooks are called links.)

A cell reference has the following form:

cell-reference:
name
[ [ [ [ [ workbook-name ] ] [ sheet-name : ] ] sheet-name ! ] A1-reference
[ [ [ [ [ workbook-name ] ] [ sheet-name : ] ] sheet-name ! ]
A1-reference : A1-reference
[ [ [ [ [ workbook-name ] ] [ sheet-name : ] ] sheet-name ! ] R1C1-reference
[ [ [ [ [ workbook-name ] ] [ sheet-name : ] ] sheet-name ! ]
R1C1-reference : R1C1-reference

workbook-name:
book-name-start-character [ book-name-characters ]

book-name-start-character:
any character except ', *, [, ], :, and ?

book-name-characters:
book-name-characters book-name-character

book-name-character:
any character except *, [, ], :, and ?

sheet-name:
sheet-name-start-character [ sheet-name-characters ]

sheet-name-start-character:
any character except ', *, [, ], \, :, /, and ?

sheet-name-characters:
sheet-name-characters sheet-name-character

sheet-name-character:
any character except *, [, ], \, :, /, and ?

A relative cell reference is based on the relative position of the cell that contains the formula and the cell to which the reference refers. If the position of the cell that contains the formula changes, the reference is changed along with it.

An absolute cell reference always refers to the absolute location of a cell. If the position of the cell that contains the formula changes, the absolute reference remains the same.

A mixed cell reference has either an absolute column and relative row, or an absolute row and relative column.

It is possible to process the same cell or set of cells on multiple worksheets within a workbook, using a 3-D reference. A reference of this type is made up of the cell reference, preceded by a range of worksheet names, and an exclamation mark character (!), in that order. A 3-D reference can be used to refer to cells on other sheets, to defined names, and to create formulas by using the following functions: AVERAGE, AVERAGEA, COUNT, COUNTA, MAX, MAXA, MIN, MINA, PRODUCT, STDEV, STDEVA, STDEVP, STDEVPA, SUM, VAR, VARA, VARP, and VARPA.

3-D references shall not be used in multi-cell formulas.

By default, a cell reference is understood to refer to one or more cells in the current worksheet. However, a cell reference can be preceded by its parent worksheet name and an exclamation mark (!), in that order. This allows cells in one worksheet to be referenced in another worksheet of the same workbook. [Example: The cell reference MonthlyTotals!D1:D12 might be used from within a sibling (or the same) worksheet of MonthlyTotals to refer to those 12 cells. end example]

An area is a set of rectangular-shaped contiguous cells. An area can be a single cell. [Example: A5 and B6:C10 each designate one area, and D3:D5,E12:F15 designates two areas (the comma (,) being the union operator). end example] [Note: The number of areas designated by a cell reference can be obtained by calling the function AREAS3.17.7.10). end note]

There are two cell reference styles: A1 (§3.17.2.3.1) and R1C1 (§3.17.2.3.2).

A1-Style Cell References

A cell reference using the A1 reference style has the following form:

A1-reference:
A1-column
A1-row
A1-column A1-row

A1-column:
A1-relative-column
A1-absolute-column

A1-relative-column:
A Latin letter A–Z
The Latin letters AA–AZ, BA–BZ, …, ZA–ZZ, AAA-AAZ, ABA–ABZ, …, and so on

A1-absolute-column:
$ A1-relative-column

A1-row:
A1-relative-row
A1-absolute-row

A1-relative-row:
A positive decimal number

A1-absolute-row:
$ relative-row

In this style, each row has a numeric heading numbered sequentially from the top down, starting at 1. Each column has an alphabetic heading named sequentially from left-to-right, A–Z, then AA–AZ, BA–BZ, …, ZA–ZZ, AAA–AAZ, ABA–ABZ, and so on. Column letters are not case-sensitive.

A relative reference to a single cell is written as its column letter immediately followed by its row number. A relative reference to a whole row is written as its row number. A relative reference to a whole column is written as its column letter. A reference to a range of two or more cells is written as two single-cell references separated by the binary range operator (:). An absolute A1 reference is made up of a cell's column letter followed by its row number, with each being preceded by a dollar character ($). [Example: A2, B34, and B5:D8 are relative A1 references. $A$2, $B$34, and $B$5:$D$8 are absolute A1 references. $A2, B$34, and $B5:D$8 are mixed A1 references. end example]

[Example: SUM(Sheet2:Sheet13!B5) adds all the values contained in cell B5 on all the worksheets between and including Sheet2 and Sheet13. end example]

For rules on how deal with potential ambiguities between cell references and defined names, see §3.17.5.1.

R1C1-Style Cell Reference

A cell reference using the R1C1 reference style has the following form:

R1C1-reference:
R1C1-row
R1C1-column
R1C1-row R1C1-column

R1C1-row:
R1C1-relative-row
R1C1-absolute-row

R1C1-relative-row:
R [ R1C1-relative-number ]

R1C1-absolute-row:
R
R R1C1-absolute-number

R1C1-column:
R1C1-relative-column
R1C1-absolute-column

R1C1-relative-column:
C [ R1C1-relative-number ]

R1C1-absolute-column:
C
C R1C1-absolute-number

R1C1-relative-number:
An optionally signed decimal number

R1C1-absolute-number:
A positive decimal number

In this style, each row has a numeric heading numbered sequentially from the top down, starting at 1. Each column has a numeric heading numbered sequentially from left-to-right, starting at 1.

A whole row is referenced by omitting the column, and a whole column is referenced by omitting the row. An absolute row or column reference uses absolute row or column numbers, respectively. A relative row or column reference uses, respectively, row or column offsets from the cell containing the formula, with a negative offset indicating a row to the left or a column above, and a positive offset indicateing a row to the right or a column below. Specifying an offset of zero is equivalent to omitting that offset and its delimiting brackets. [Example: R[-2]C refers to the cell two rows up and in the same column, R[2]C[2] refers to the cell two rows down and two columns to the right, R2C2 refers to the cell in the second row and in the second column, R[-1] refers to the entire row above the active cell, and R refers to the current row. end example]

The R1C1 alternate reference style can only be used at runtime. See §3.17.6.1 for XML-related details.